// pages/Transmit2/Transmit2.js
const util = require('../../utils/http.js')

Page({

  /**
   * 页面的初始数据
   */
  data: {
    IsShare: 0, //是否从分享而来,1是 0否
    Text: '', //由分享过来的推荐语
    sourceId: '', //由分享过来的项目创建人
    shareUserId: '', //由分享过来的分享人
    proId: '', //项目Id
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var isShare = options.isShare;
    var text = options.text;
    var sourceId = options.sourceId;
    var shareUserId = options.shareUserId;
    var proId = options.proId;

    if (isShare == 1) {
      this.setData({
        IsShare: options.isShare,
        Text: options.text,
        sourceId: options.sourceId,
        shareUserId: options.shareUserId,
        proId: options.proId,
      })
      this.uploadShareInfo();
    } else {
      this.setData({
        proId: options.proId,
      })
    }
  },

  //上传分享信息
  uploadShareInfo: function () {

    var pars = {
      'source_user_id': this.data.sourceId,
      'pro_id': this.data.proId,
      'share_user_id': this.data.shareUserId,
      'receive_user_id': getApp().globalData.userInfo.user_id, //我的id
      'share_word': this.data.Text,
      'share_url': '', //分享链接
    }

    util.POST(true, 'Orders/order_resend', pars, function (res) { })
  },
})